//
//  PersonSearchView.swift
//  SBSafetyApp
//
//  Created by Lina on 2023/11/28.
//

import Foundation
import UIKit

class PersonSearchView: UIView {
    let nameItem = SuperviseReportSearchTF(withPlaceholder: "姓名")
    let jobItem = SuperviseReportSearchTF(withPlaceholder: "工号")
    let phoneItem = SuperviseReportSearchTF(withPlaceholder: "手机号")

    let submitBtn = UIButton.createPrimaryLarge("搜索")

    override init(frame: CGRect) {
        super.init(frame: frame)
        backgroundColor = .bg
        setupUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setupUI() {
        addSubview(nameItem)
        nameItem.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(self.snp.top).offset(10)
            make.height.equalTo(56)
            make.left.right.equalToSuperview()
        }
        
        addSubview(jobItem)
        jobItem.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(nameItem.snp.bottom).offset(10)
            make.height.equalTo(56)
            make.left.right.equalToSuperview()
        }
        
        addSubview(phoneItem)
        phoneItem.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(jobItem.snp.bottom).offset(10)
            make.height.equalTo(56)
            make.left.right.equalToSuperview()
        }
        
        addSubview(submitBtn)
        submitBtn.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(phoneItem.snp.bottom).offset(31)
            make.height.equalTo(50)
            make.centerX.equalTo(self.snp.centerX)
            make.width.equalTo(ScreenWidth - 20)
        }
    }
}
